package sum;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableUtils;

public class CompositeKey implements WritableComparable<CompositeKey> {
	int line;
	int date;
		
	public void write(DataOutput out) throws IOException {
		WritableUtils.writeVInt(out, line);
		WritableUtils.writeVInt(out, date);
	}
	
	public void readFields(DataInput in) throws IOException {
		this.line = WritableUtils.readVInt(in);
		this.date = WritableUtils.readVInt(in);
	}
	
	public int compareTo(CompositeKey pop) {
		if (pop == null)
			return 0;
		int intcnt = Integer.compare(this.line, pop.line);
		
		return intcnt;
	}
	
	@Override
	public String toString() {
		return line + "\t" + date;
	}

    public int getLine() {
        return line;
    }

    public void setLine(int line) {
        this.line = line;
    }

    public int getDate() {
        return date;
    }

    public void setDate(int date) {
        this.date = date;
    }

    
	

}
